package net.melon.sysres.manager;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import net.melon.sysres.pojo.Attachment;
import net.melon.sysres.pojo.ExceptionCode;
import net.melon.sysres.pojo.I18N;
import net.melon.sysres.pojo.SysApplication;
import net.melon.sysres.pojo.SysFieldProperty;
import net.melon.sysres.pojo.SysProperty;
import net.melon.sysres.pojo.SysScheduler;
import net.melon.sysres.pojo.SysUserRule;

public interface SystemManager {

	SysProperty saveProperty( SysProperty property);
	
	SysProperty updateProperty( SysProperty property);
	
	void deleteProperty(SysProperty property);
	
	List<SysProperty> loadProperties(boolean force);
	
	
	void mkDir(File parent,String name);
	
	File[] loadChildFiles(File parent);
	
	void uploadFile(File path,File realfile);
	
	SysUserRule saveUserRule(SysUserRule userRule);
	
	SysUserRule updateUserRule(SysUserRule userRule);
	
	void deleteUserRule(SysUserRule userRule);
	
	/*******************ATTACHMENT*******************************/
	Attachment saveAttachment(File templateFile,String templateFileName) throws IOException;
	
	Attachment getAttachment(String id);
	
	Attachment updateAttachment(String id,File templateFile,String templateFileName) throws IOException;
	
	void deleteAttachment(String id);
	
	/*********************************i18n & exceptionCode ***************/
	I18N getI18N(String sourceName,String code,Locale locale);
	
	void reloadI18N();
	
	ExceptionCode getExceptionCode(String code,Locale locale);
	
	void reloadExceptionCode();
	
	/************************************fieldProperty & application********************/
	List<SysFieldProperty> listFieldProperty(String model,String url,Map params);

	SysFieldProperty updateFieldProperty(SysFieldProperty property);
	
	void cloneFieldProperty(String model,String url);
	
	List<String> listFieldPropertyUrl(String model);
	
	List<SysApplication> applications();
	
	SysApplication getApplication(String id);
	
	SysApplication saveApplication(SysApplication entity);
	
	SysApplication updateApplication(SysApplication entity);
	
	void reloadApplicationClasses();
	
}
